Python Programming Fundamentals by Kent D. Lee
Author:Kent D. Lee
Language: eng
Format: epub, pdf
Publisher: Springer London, London
4.3 Mutator Methods
Mutator methods, as the name suggests, change or mutate the state of the object. Sect. 3.5 introduced the mutability of lists. Mutator methods are called the same as accessor methods. Where an accessor method usually gives you information back, a mutator method may require you to provide some information to the object.
Fig. 4.3Two references to one object
Example 4.5
Here are some calls to mutator methods.
One misconception about object-oriented programming is that assigning one reference to another creates two separate objects. This is not the case as is demonstrated by the following code. This isn’t a problem if the object doesn’t change. However, when the object may be mutated it is important to know that the object is changing and this means that it changes for all references that point at the object.
Example 4.6
Here is an example of one turtle with two different references to it. Both t and r refer the the same turtle.
Download
Python Programming Fundamentals by Kent D. Lee.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ada | Ajax |
Assembly Language Programming | Borland Delphi |
C & C++ | C# |
CSS | Compiler Design |
Compilers | DHTML |
Debugging | Delphi |
Fortran | Java |
Lisp | Perl |
Prolog | Python |
RPG | Ruby |
Swift | Visual Basic |
XHTML | XML |
XSL |
Hello! Python by Anthony Briggs(9904)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9785)
The Mikado Method by Ola Ellnestam Daniel Brolund(9769)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8282)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7771)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7756)
Grails in Action by Glen Smith Peter Ledbrook(7686)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7550)
Windows APT Warfare by Sheng-Hao Ma(6773)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6499)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6399)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6367)
Kotlin in Action by Dmitry Jemerov(5048)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4313)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3972)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3755)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3699)
The Ultimate iOS Interview Playbook by Avi Tsadok(3675)
